home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / pj9_3.arc / ASM.INC next >
Text File  |  1991-10-07  |  2KB  |  140 lines

  1.     .xlist
  2.     page    63,128
  3.  
  4.     .model    small
  5.     ASSUME    ds:nothing
  6. ;    includelib lib
  7.  
  8.  
  9. bptr            equ    byte ptr
  10. wptr            equ    word ptr
  11. dptr            equ    dword ptr
  12.  
  13. stdin            equ    0
  14. stdout            equ    1
  15. stderr            equ    2
  16.  
  17. FILENAME_MAX        equ    80
  18. FOPEN_MAX        equ    20
  19.  
  20. ZER0            equ    0
  21.  
  22. NULL_POINTER        equ    0
  23. NULL_HANDLE        equ    0
  24.  
  25. NULL_CHAR        equ    0
  26. TAB_CHAR        equ    9
  27. EOL_CHAR        equ    10    ; end of line
  28. LF_CHAR            equ    10    ; linefeed
  29. CR_CHAR            equ    13    ; carriage return
  30. SPACE_CHAR        equ    ' '
  31.  
  32. NEWLINE_CHARS        equ    0A0Dh
  33.  
  34. BLOCK_SIZE        equ    16384    ; size of an EMS block
  35.  
  36.  
  37. ; MACROs
  38.  
  39. ; smart CMP marco
  40. ;
  41. cmpx    macro    dst,src
  42.     if    src eq 0
  43.     or    dst,dst
  44.     else
  45.     cmp    dst,src
  46.     endif
  47.     endm
  48.  
  49.  
  50. ; smart MOV macro
  51. ;
  52. movx    macro    dst,src
  53.     ifidn    <src>,<DGROUP_SEGMENT>
  54.     push    ss
  55.     pop    dst
  56.     exitm
  57.     endif
  58.  
  59.     if    (type src) eq 0            ; if register or constant AND
  60.     if    ((.type src) and 11100b) eq 0    ; if not any register      AND
  61.     if    src eq 0            ; if source is zero
  62.     sub    dst,dst                ; then efficiently 0 register
  63.     exitm
  64.     endif
  65.     endif
  66.     endif
  67.  
  68.     mov    dst,src
  69.     endm
  70.  
  71.  
  72. ; OPTASM macros
  73. ;
  74.     IFNDEF    .date    ; if not OPTASM
  75.     .sall        ; don't show macro contents
  76.  
  77. extb    macro    a,b,c,d,e,f,g,h,i,j,k
  78.     irp    xx,<a,b,c,d,e,f,g,h,i,j,k>
  79.     ifnb    <xx>
  80.     extrn    xx:byte
  81.     else
  82.     exitm
  83.     endif
  84.     endm
  85.     endm
  86.  
  87. extd    macro    a,b,c,d,e,f,g,h,i,j,k
  88.     irp    xx,<a,b,c,d,e,f,g,h,i,j,k>
  89.     ifnb    <xx>
  90.     extrn    xx:dword
  91.     else
  92.     exitm
  93.     endif
  94.     endm
  95.     endm
  96.  
  97. extn    macro    a,b,c,d,e,f,g,h,i,j,k
  98.     irp    xx,<a,b,c,d,e,f,g,h,i,j,k>
  99.     ifnb    <xx>
  100.     extrn    xx:near
  101.     else
  102.     exitm
  103.     endif
  104.     endm
  105.     endm
  106.  
  107. extw    macro    a,b,c,d,e,f,g,h,i,j,k
  108.     irp    xx,<a,b,c,d,e,f,g,h,i,j,k>
  109.     ifnb    <xx>
  110.     extrn    xx:word
  111.     else
  112.     exitm
  113.     endif
  114.     endm
  115.     endm
  116.  
  117. pushm    macro    a,b,c,d,e,f,g,h,i,j,k
  118.     irp    xx,<a,b,c,d,e,f,g,h,i,j,k>
  119.     ifnb    <xx>
  120.     push    xx
  121.     else
  122.     exitm
  123.     endif
  124.     endm
  125.     endm
  126.  
  127. popm    macro    a,b,c,d,e,f,g,h,i,j,k
  128.     irp    xx,<a,b,c,d,e,f,g,h,i,j,k>
  129.     ifnb    <xx>
  130.     pop    xx
  131.     else
  132.     exitm
  133.     endif
  134.     endm
  135.     endm
  136.  
  137.     ENDIF        ; end MASM/TASM macros
  138.  
  139.     .list        ; end of asm.inc
  140.